package com.mengya.utils;
import java.util.List;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TabHost.TabContentFactory;

import com.gzcwt.entity.Notice;
import com.mengya.adapter.NoticeTabListAdapter;
public class TabFactory implements TabContentFactory {
	private Context con;
	private List<Notice> notices;
	private int tabnum;
	public TabFactory(Context c , List<Notice> notices , int tabnum){
		this.con=c;
		this.notices = notices;
		this.tabnum = tabnum;
	}
	@Override
	public View createTabContent(String arg0) {
		ListView lv= new ListView(con);
        lv.setAdapter(new NoticeTabListAdapter(con,notices));
        if(tabnum == 0){
        	lv.setOnItemClickListener(new OnItemClickListener() {  
        		@Override  
        		public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {  
        			/*NoticeDBO ndbo = new NoticeDBO();
        			ndbo.setNoticeReaded(notices.get(position).getId());
        			ndbo.closeDB();*/
        			
        			Log.i("id", notices.get(position).getId()+"");
        		}  
        	});  
        }
        return lv; 
	}
}